package com.xyz.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xyz.pojo.ProductCategory;
import com.xyz.repository.CategoryRepository;
import com.xyz.service.CategoryService;

@Service
public class CategoryServiceImpl implements CategoryService {

	@Autowired
	private CategoryRepository categoryRepository;

	public ProductCategory findById(Integer categoryId) {
		return categoryRepository.findById(categoryId).get();
	}

	public List<ProductCategory> findAll() {
		return categoryRepository.findAll();
	}

	public List<ProductCategory> findByCategoryTypeIn(List<Integer> categoryTypeList) {

		return categoryRepository.findByCategoryTypeIn(categoryTypeList);
	}

	public ProductCategory save(ProductCategory productCategory) {
		return categoryRepository.save(productCategory);
	}
}
